# coding=UTF-8
# author=suemi
# created at 16/5/13

import hashlib

def singleton(class_):
    """
    使用修饰器来实现单体模式
    :param class_:
    :return:
    """
    instances = {}

    def getinstance(*args, **kwargs):
        if class_ not in instances:
            instances[class_] = class_(*args, **kwargs)
        return instances[class_]

    return getinstance

class ToolUtil:
    """
    提供一些底层的小工具
    """

    md5Generator = hashlib.md5()

    @classmethod
    def md5(cls,dst):
        cls.md5Generator.update(dst)
        return cls.md5Generator.hexdigest()


